package za.org.jcicada.katcp;

/**
 * IRequestHandler.java
 *
 * @author Simon Cross
 *
 * Created on October 13, 2008, 13:45
 */

import za.org.jcicada.katcp.Message;

import java.nio.channels.SocketChannel;

/**
 * Represents a KAT device request method handler.
 */
public interface IRequestHandler {

    /**
     * Handle a request Message.
     *
     * @param sc  A SocketChannel to the client who sent the request.
     * @param msg  The request Message.
     * @return  The reply Message.
     * @throws Exception  If something goes wrong.
     */
    Message handle (SocketChannel sc, Message msg) throws Exception;

    /**
     * Get the name of the request Messages the handler processes.
     *
     * @return The name of the requests processed.
     */
    String getName();

    /**
     * Get a description of what the handler does.
     *
     * @return A short help message.
     */
    String getHelp();
}
